/*
* ======================================================================
* ----------------------------------------------------------------------
* zFCviewer:	zon Focused-Content Viewer
* Author:		zon
* Website:		http://inimu.com
* ----------------------------------------------------------------------
* You may use and/or modify the codes below and its associated files
* as long as you leave the author credit remain intact
* ----------------------------------------------------------------------
* ======================================================================
*/


// check container element
// ---------------------------------------------------------------------
if (document.getElementById('zfcvOpener') == null) {
	document.write('<input id="zfcvOpener" name="zfcvOpener" type="button" value="Show the content only" onclick="zfcvToggleDisplay(\'content\',\'10%\',\'80%\',\'10%\',\'5%\',\'90%\',\'5%\');" />');
}


var zfcvFadeTime = 350;
var zfcvContentLoaded = false;
var zfcvControllerAdded = false;
var zfcvALEadded;

function zfcvPutStyle() {
	var zfcvStyleRules = ''
	+'#zfcvOpener { border-radius:7px; -moz-border-radius:7px; -webkit-border-radius:7px; -khtml-border-radius:7px; } '
	+'div#zfcvBgContainer, div#zfcvContentWindow { position:fixed; }'
	+'div#zfcvBg, div#zfcvControlBtnContainer, div#zfcvContentContainer, div#zfcvContent, div#zfcvContentWindowBg { position:absolute; }'
	+'div#zfcvBgContainer { z-index:10000000; '
		+'top:0; right:0; bottom:0; left:0; background:none repeat scroll 0 0 transparent; }'
	+'div#zfcvBg { top:0; right:0; bottom:0; left:0; background-color:#000; opacity:0.7; filter:alpha(opacity=70); }'
	+'div#zfcvContentWindow { z-index:10000002; '
		+'border:none solid #fff; background-color:#fff; '
		+'border-radius:8px; -moz-border-radius:8px; -webkit-border-radius:8px; -khtml-border-radius:8px; '
		+'box-shadow:0 0 20px #000; -moz-box-shadow:0 0 20px #000; -webkit-box-shadow:0 0 20px #000; -khtml-box-shadow:0 0 20px #000; }'
	+'div#zfcvControlBtnContainer { top:0; right:0; bottom:auto; left:0; z-index:10000005; '
		+'margin:0; padding:0 15px 0 10px; height:23px; '
		+'background-color:transparent; border-bottom:1px solid #ddd; '
		+'font-family:"Trebuchet MS",Verdana,Arial,sans-serif; font-weight:normal; font-size:13px; line-height:20px; vertical-align:baseline; }'
	+'a#zfcvAL, a#zfcvClose { cursor:pointer; text-decoration:none; margin:0; padding:0; color:#000; opacity:0.4; filter:alpha(opacity=40); }'
	+'a#zfcvAL { float:left; }'
	+'a#zfcvClose { float:right; '
		+'border:1px solid #999; border-top:none; background-color:transparent; '
		+'border-radius:0 0 4px 4px; -moz-border-radius:0 0 4px 4px; -webkit-border-radius:0 0 4px 4px; -khtml-border-radius:0 0 4px 4px; '
		+'font-weight:bold; line-height:18px; padding:0 15px; }'
	+'a#zfcvAL:hover, a#zfcvClose:hover { opacity:1; filter:alpha(opacity=100); }'
	+'a#zfcvClose:hover { border-color:#000; }'
	+'div#zfcvContentContainer { top:24px; right:0; bottom:7px; left:0; z-index:10000004; overflow:auto; '
		+'background-color:#fff; border-radius:7px; -moz-border-radius:7px; -webkit-border-radius:7px; -khtml-border-radius:7px; }'
	+'div#zfcvContent { background-color:#fff; margin:10px; overflow:hidden; word-wrap:break-word; z-index:10000005; }'
	+'';
	var zfcvSE = document.createElement('style');
	zfcvSE.type = 'text/css';
	if (!!(window.attachEvent && !window.opera)) {
		zfcvSE.styleSheet.cssText = zfcvStyleRules;
	} else {
		var zfcvST = document.createTextNode(zfcvStyleRules);
		zfcvSE.appendChild(zfcvST);
	}
	document.getElementsByTagName('head')[0].appendChild(zfcvSE);
}

zfcvPutStyle();

var zfcvHTMLtext = ''
+'<div id="zfcvBgContainer" style="display:none; opacity:0; filter:alpha(opacity=0);">'
	+'<div id="zfcvBg">'
	+'</div>'
+'</div>'
+'<div id="zfcvContentWindow" style="display:none; opacity:0; filter:alpha(opacity=0);">'
	+'<div id="zfcvControlBtnContainer">'
		+'<a id="zfcvClose" title="Close this">x</a>'
	+'</div>'
	+'<div id="zfcvContentContainer">'
		+'<div id="zfcvContent">'
		+'</div>'
	+'</div>'
+'</div>'
+'';
document.write(zfcvHTMLtext);

var zfcvBCE = document.getElementById('zfcvBgContainer');
var zfcvBE = document.getElementById('zfcvBg');
var zfcvCWE = document.getElementById('zfcvContentWindow');
var zfcvCBCE = document.getElementById('zfcvControlBtnContainer');
var zfcvCE = document.getElementById('zfcvContent');
var zfcvALE = document.createElement('a');
zfcvALE.id = unescape('%7A%66%63%76%41%4C');
zfcvALE.href = unescape('%68%74%74%70%3A%2F%2F%69%6E%69%6D%75%2E%63%6F%6D%2F%77%69%64%67%65%74%2F%7A%66%63%76%69%65%77%65%72%2F');
zfcvALE.title = unescape('%7A%46%43%76%69%65%77%65%72%20%2D%20%46%6F%63%75%73%65%64%2D%43%6F%6E%74%65%6E%74%20%56%69%65%77%65%72%20%77%69%64%67%65%74%20%62%79%20%7A%6F%6E');
zfcvALE.setAttribute('target','_blank');
var zfcvALTE = document.createTextNode(unescape('%69%6E%66%6F'));
zfcvALE.appendChild(zfcvALTE);
zfcvCBCE.insertBefore(zfcvALE,zfcvCBCE.firstChild);
var zfcvUserContentElmId; var l; var w; var r; var t; var h; var b;

function zfcvToggleFade(eid) {
	var element = document.getElementById(eid);
	if (element == null) { return; }
	if(element.FadeState == null) {
		if (element.style.opacity == null || element.style.opacity == '' || element.style.opacity == '1') {
			element.FadeState = 2;
		} else {
			element.FadeState = -2;
		}
	}
	if (element.FadeState == 1 || element.FadeState == -1) {
		element.FadeState = element.FadeState == 1 ? -1 : 1;
		element.FadeTimeLeft = zfcvFadeTime - element.FadeTimeLeft;
	} else {
		element.FadeState = element.FadeState == 2 ? -1 : 1;
		element.FadeTimeLeft = zfcvFadeTime;
		setTimeout('zfcvAnimFade('+new Date().getTime()+',\''+eid+'\')', 4);
	}
}

function zfcvAnimFade(lastTick, eid) {
	var curTick = new Date().getTime();
	var elapsedTicks = curTick - lastTick;
	var element = document.getElementById(eid);
	if(element.FadeTimeLeft <= elapsedTicks) {
		element.style.opacity = element.FadeState == 1 ? '1' : '0';
		element.style.filter = 'alpha(opacity='+(element.FadeState == 1 ? '100' : '0')+')';
		element.FadeState = element.FadeState == 1 ? 2 : -2;
		return;
	}
	element.FadeTimeLeft -= elapsedTicks;
	var newOpVal = element.FadeTimeLeft/zfcvFadeTime;
	if (element.FadeState == 1) {
		newOpVal = 1 - newOpVal;
	}
	element.style.opacity = newOpVal;
	element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
	setTimeout('zfcvAnimFade('+curTick+',\''+eid+'\')', 4);
}

function zfcvToggleDisplay(zfcvUserContentElmId,l,w,r,t,h,b) {
	var zfcvUserContentHTML = document.getElementById(zfcvUserContentElmId).innerHTML;
	var zfcvFunctionCall = 'zfcvToggleDisplay(\''+zfcvUserContentElmId+'\',\''+l+'\',\''+w+'\',\''+r+'\',\''+t+'\',\''+h+'\',\''+b+'\')';
	document.getElementById('zfcvClose').setAttribute('onclick',zfcvFunctionCall);
	if (zfcvBCE.style.display == 'none') {
		if (!zfcvContentLoaded) {
			zfcvCE.innerHTML = zfcvUserContentHTML;
			zfcvContentLoaded = true;
		}
		var	zfcvOpenerElmLength = document.getElementsByName('zfcvOpener').length;
		var i = 0;
		for (i = 0; i < zfcvOpenerElmLength; i++) {
			document.getElementsByName('zfcvOpener')[i].style.display = 'none';
		}
		zfcvCWE.style.left = l;
		zfcvCWE.style.width = w;
		zfcvCWE.style.right = r;
		zfcvCWE.style.top = t;
		zfcvCWE.style.height = h;
		zfcvCWE.style.bottom = b;
		zfcvBCE.style.display = 'block';
		zfcvCWE.style.display = 'block';
		zfcvBE.setAttribute('onclick',zfcvFunctionCall);
		zfcvToggleFade('zfcvBgContainer');
		setTimeout('zfcvToggleFade(\'zfcvContentWindow\')', zfcvFadeTime/2);
	} else {
		zfcvBE.setAttribute('onclick','');
		zfcvToggleFade('zfcvContentWindow');
		setTimeout('zfcvToggleFade(\'zfcvBgContainer\')', zfcvFadeTime/2);
		setTimeout('zfcvHide()', zfcvFadeTime);
	}
}

function zfcvHide() {
	zfcvCWE.style.display = 'none';
	zfcvBCE.style.display = 'none';
	var	zfcvOpenerElmLength = document.getElementsByName('zfcvOpener').length;
	var i = 0;
	for (i = 0; i < zfcvOpenerElmLength; i++) {
		document.getElementsByName('zfcvOpener')[i].style.display = 'block';
	}
}
